package com.laf.manage.controller.user;

import com.laf.common.core.controller.BaseController;
import com.laf.common.core.domain.R;
import com.laf.manage.domain.doc.ReceiveRecordDoc;
import com.laf.manage.domain.dto.PageDTO;
import com.laf.manage.domain.query.ReceiveRecordQuery;
import com.laf.manage.domain.vo.RecordDetailsVO;
import com.laf.manage.service.IReceiveRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 领取记录Controller
 *
 * @author zian
 * @date 2024-11-01
 */
@Slf4j
@Api(tags="领取记录管理")
@RestController("userReceiveRecordController")
@RequestMapping("/user/receive-record")
@RequiredArgsConstructor
public class ReceiveRecordController extends BaseController
{

    private final IReceiveRecordService receiveRecordService;


    /**
     * 获取当前用户的领取记录列表
     */
    @GetMapping("/current/page")
    @ApiOperation("自己的领取记录列表信息")
    public R<PageDTO<ReceiveRecordDoc>> getCurrentReceiveRecordList(ReceiveRecordQuery query) {
        log.info("获取当前用户的领取记录列表 参数：{}", query);
        PageDTO<ReceiveRecordDoc> vo = receiveRecordService.getCurrentReceiveRecordList(query);
        return R.ok(vo);
    }

    /**
     * 获取领取记录详情
     */
    @GetMapping("/details/{id}")
    @ApiOperation("获取领取记录详情")
    public R<RecordDetailsVO> getReceiveRecordDetails(@PathVariable("id") Long id) {
        log.info("获取领取记录详情 参数：{}", id);
        RecordDetailsVO vo = receiveRecordService.getReceiveRecordDetails(id);
        return R.ok(vo);
    }

}
